package twoPointer;

import java.util.Scanner;

/**
 * Created by JiaJia on 2019/4/18 0018.
 */
public class SunofSquare {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int input=sc.nextInt();
            System.out.println(judgeSquareNum(input));
        }
        sc.close();
    }
    private static boolean judgeSquareNum(int input){
        int i=0;
        int j=(int)Math.sqrt(input);
        while (i<j){
            int sum=i*i + j*j;
            if(sum==input){
                return true;
            }else if(sum<input){
                i++;
            }else {
                j--;
            }
        }
        return false;
    }
}